Skip to content

fix: use null auth store, use hook instead of zust store#1940

Merged
k11kirky merged 1 commit intomainfrom
04-29-fix_use_null_auth_store_use_hook_instead_of_zust_store
Apr 29, 2026
Merged

fix: use null auth store, use hook instead of zust store#1940
k11kirky merged 1 commit intomainfrom
04-29-fix_use_null_auth_store_use_hook_instead_of_zust_store

Conversation

@k11kirky
Copy link
Copy Markdown
Contributor

@k11kirky k11kirky commented Apr 29, 2026

Problem

Auth state was being read directly from useAuthStore in utility functions outside of React components, which is stale if this isnt the first session

Changes

  • Added getCachedAuthState() helper that reads the current AuthState directly from the React Query cache, falling back to ANONYMOUS_AUTH_STATE if no cached value exists
  • Replaced useAuthStore.getState() calls in posthogLinks.ts and urls.ts with getCachedAuthState(), making the query cache the single source of truth for auth state in non-component contexts

Copy link
Copy Markdown
Contributor Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@k11kirky k11kirky marked this pull request as ready for review April 29, 2026 13:04
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 29, 2026

Reviews (1): Last reviewed commit: "fix: use null auth store, use hook inste..." | Re-trigger Greptile

@k11kirky k11kirky enabled auto-merge (squash) April 29, 2026 13:09
@k11kirky k11kirky merged commit 41349ee into main Apr 29, 2026
16 checks passed
@k11kirky k11kirky deleted the 04-29-fix_use_null_auth_store_use_hook_instead_of_zust_store branch April 29, 2026 13:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants